package com.milotnt.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.milotnt.mapper.EquipmentMapper;
import com.milotnt.pojo.Equipment;
import com.milotnt.service.EquipmentService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author ZhangMing [1157038410@qq.com]
 * @date 2021/8/11
 */

@Service
public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment> implements EquipmentService {

    @Override
    public List<Equipment> findAll() {
        return this.list();
    }

    @Override
    public Boolean deleteByEquipmentId(Integer equipmentId) {
        return this.removeById(equipmentId);
    }

    @Override
    public Boolean insertEquipment(Equipment equipment) {
        return this.save(equipment);
    }

    @Override
    public Boolean updateEquipmentByEquipmentId(Equipment equipment) {
        return this.updateById(equipment);
    }

    @Override
    public Equipment selectByEquipmentId(Integer equipmentId) {
        return this.getById(equipmentId);
    }

    @Override
    public Integer selectTotalCount() {
        return Math.toIntExact(this.count());
    }
}
